Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jit: func_line alignment for line table #9003

Merged
merged 1 commit into from
Nov 18, 2024

Conversation

danielfinke
Copy link
Contributor

The changes from 5b4457e cause the line table to have extra entries when handling the last_error_offset. The line number from the subsequent function is mapped to the nop instruction following the error, and as a result, the line table suggests that the line is mapped in the former and current range.

As an example, if you enable logging in jit-reader.c, and look for sets.erl, you would see something like:

Add range `sets:new/0-CodeInfoPrologue` (0x7f5fddf03f18, 0x7f5fddf03f48), 0 lines
Add range `sets:new/0` (0x7f5fddf03f48, 0x7f5fddf04008), 3 lines
        sets.erl:170
        sets.erl:171
        sets.erl:177
Add range `sets:new/1-CodeInfoPrologue` (0x7f5fddf04008, 0x7f5fddf04038), 0 lines
Add range `sets:new/1` (0x7f5fddf04038, 0x7f5fddf04118), 2 lines
        sets.erl:177
        sets.erl:180

which shows that line 177 is included twice, despite only being for sets:new/1. This can also be identified by using this GDB command: maintenance info line-table sets.erl.

Move func_line back after the func label and emit the last error nop before the label. This ensures that the line is within the (possibly aligned) func range.

Copy link
Contributor

github-actions bot commented Oct 29, 2024

CT Test Results

    3 files    143 suites   49m 40s ⏱️
1 595 tests 1 546 ✅ 49 💤 0 ❌
2 339 runs  2 265 ✅ 74 💤 0 ❌

Results for commit 5295981.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@bjorng bjorng added the team:VM Assigned to OTP team VM label Oct 31, 2024
@jhogberg jhogberg added the testing currently being tested, tag is used by OTP internal CI label Nov 5, 2024
@garazdawi
Copy link
Contributor

Github actions fail due to formatting errors, please run make format and commit the updates.

@garazdawi garazdawi removed the testing currently being tested, tag is used by OTP internal CI label Nov 5, 2024
The changes from 5b4457e cause the line table to have extra entries when
handling the last_error_offset. The line number from the subsequent
function is mapped to the nop instruction following the error, and as a
result, the line table suggests that the line is mapped in the former
and current range.

As an example, if you enable logging in jit-reader.c, and look for
sets.erl, you would see something like:

```
Add range `sets:new/0-CodeInfoPrologue` (0x7f5fddf03f18, 0x7f5fddf03f48), 0 lines
Add range `sets:new/0` (0x7f5fddf03f48, 0x7f5fddf04008), 3 lines
        sets.erl:170
        sets.erl:171
        sets.erl:177
Add range `sets:new/1-CodeInfoPrologue` (0x7f5fddf04008, 0x7f5fddf04038), 0 lines
Add range `sets:new/1` (0x7f5fddf04038, 0x7f5fddf04118), 2 lines
        sets.erl:177
        sets.erl:180
```

which shows that line 177 is included twice, despite only being for
sets:new/1. This can also be identified by using this GDB command:
`maintenance info line-table sets.erl`.

Move func_line back after the func label and emit the last error nop
before the label. This ensures that the line is within the (possibly
aligned) func range.
@danielfinke danielfinke force-pushed the jit-func-line-alignment branch from e5a9522 to 5295981 Compare November 11, 2024 00:59
@danielfinke
Copy link
Contributor Author

Github actions fail due to formatting errors, please run make format and commit the updates.

Fixed formatting with a typo fix & ran make format to confirm

@jhogberg jhogberg added the testing currently being tested, tag is used by OTP internal CI label Nov 11, 2024
@michalmuskala
Copy link
Contributor

Can this issue also affect function attribution in tools like perf?

@jhogberg jhogberg merged commit 10bfe4a into erlang:maint Nov 18, 2024
21 checks passed
@jhogberg
Copy link
Contributor

Merged, thanks for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants